/**
 */
package com.dingpeikeji.quickdeer.core.modules.driver.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dingpeikeji.quickdeer.core.common.persistence.Page;
import com.dingpeikeji.quickdeer.core.common.service.CrudService;
import com.dingpeikeji.quickdeer.core.modules.driver.dao.TDriversDao;
import com.dingpeikeji.quickdeer.core.modules.driver.entity.TDrivers;
import com.dingpeikeji.quickdeer.core.modules.sys.entity.Office;
import com.dingpeikeji.quickdeer.core.modules.sys.entity.User;
import com.dingpeikeji.quickdeer.core.modules.sys.utils.UserUtils;

/**
 * 司机管理Service
 * @author lh
 * @version 2016-05-25
 */
@Service
@Transactional(readOnly = true)
public class TDriversService extends CrudService<TDriversDao, TDrivers> {

	public TDrivers get(String id) {
		return super.get(id);
	}
	
	public List<TDrivers> findList(TDrivers tDrivers) {
		return super.findList(tDrivers);
	}
	
	public Page<TDrivers> findPage(Page<TDrivers> page, TDrivers tDrivers) {
		return super.findPage(page, tDrivers);
	}
	
	@Transactional(readOnly = false)
	public void save(TDrivers tDrivers) {
		super.save(tDrivers);
	}
	public void update(TDrivers tDrivers) {
		super.update(tDrivers);
	}
	@Transactional(readOnly = false)
	public void delete(TDrivers tDrivers) {
		super.delete(tDrivers);
	}
	
	@Transactional(readOnly = false)
	public boolean bindDriver(String phone, String openid) {
		if(dao.bindDriver(phone, openid) > 0){
			return true;
		} else {
			return false;
		}
	}
	
	/**
	 * 根据身份证号获取司机
	 * @param idnumber
	 * @return
	 */
	public TDrivers getDriverByIdnumber(String idnumber) {
		return dao.getDriverByIdnumber(idnumber);
	}
	/**
	 * 根据手机号获取司机
	 * @param mobile
	 * @return
	 */
	public TDrivers getDriverByMobile(String mobile) {
		return dao.getDriverByMobile(mobile);
	}
	/**
	 * 根据驾车证获取司机
	 * @param drvlicno
	 * @return
	 */
	public TDrivers getDriverByDrvlicno(String drvlicno) {
		return dao.getDriverByDrvlicno(drvlicno);
	}
	
	/**
	 * 根据姓名和公司证获取司机
	 * @param drvlicno
	 * @return
	 */
	public TDrivers getDriverByName(TDrivers tDrivers){
		return dao.getDriverByName(tDrivers);
	}
			
}
